package dao;

import java.util.Date;

import org.hibernate.Session;
import org.hibernate.Transaction;
import conexao.HibernateUtil;
import model.Contato;


public class HibernateTest {
	public static void main(String[] args) {
		Contato c = new Contato();
		c.setNome("Ronaldo2");
		c.setEmail("marcelo@rafa3d.com.br");
		c.setTelefone("48548484");
		c.setDtCadastro(new Date());
		c.setObs("campo Observacao");
		
		
		Session session = null;
		Transaction transacao = null;
		try {
			session = HibernateUtil.getSessionFactory().openSession();
			transacao = session.beginTransaction();
			session.save(c);
			transacao.commit();	
		} catch (Exception e) {
			e.printStackTrace();
		}
		
	}
}
